<?php	

	
	$conexion = mysql_connect('localhost','jesus','camacho');
	mysql_select_db('datos',$conexion);
	
	$peticion = mysql_query("SELECT * FROM almacenes ");
	
			// creating an array from results:
		$users = array();
		if(mysql_num_rows($peticion)) {
			while($user = mysql_fetch_assoc($peticion)) {
				$users[] = array('user'=>$user);
			}
		}
 
		// now, the output in JSON format:
		header('Content-type: application/json');
		echo json_encode(array('users'=>$users));
 
		// disconnect from the db
		@mysql_close($link);
	
?>